;
(function() {

	var role = require("./role");
	var BusCon = require("../../core/bus/_con");
	var UserCon = require("../../core/user/_con");
	var GoodsCon = require("../../core/goods/_con");
	var AchCon = require("../../core/ach/_con");
	var db = require("../../core/db/index");
	var config = require("../../core/_include/config");
	var ResponObj = require("../_include/responObj");
	module.exports = {
		prefix: "/bus/express",
		get: {
			"/list": function() {
				var bus = role.getBus(this);
				this.body = ResponObj("json", bus.getExpressList());
			},
		},
		post: {
			"/add_express": function() {
				var bus = role.getBus(this);
				var query = this.request.query;
				var new_express_info = this.request.body;

				var express = bus.addExpress(new_express_info);

				if (query.return_type == "list") {
					this.body = ResponObj("json", bus.getExpressList());
				} else {
					this.body = ResponObj("json", express);
				}
			},
		},
		put: {
			"/update_express/:express_id": function() {
				var bus = role.getBus(this);
				var query = this.request.query;
				var express_info = this.request.body;
				var express_id = this.params.express_id;

				var express = bus.updateExpress(express_id, express_info);

				if (query.return_type == "list") {
					this.body = ResponObj("json", bus.getExpressList());
				} else {
					this.body = ResponObj("json", express);
				}
			},
		},
		"delete": {
			"/remove_express/:express_id": function() {
				var bus = role.getBus(this);
				var express_id = this.params.express_id;

				bus.removeExpress(express_id);
				this.body = ResponObj("json", bus.getExpressList());
			}
		}
	}
}());